/*import org.slf4j.Logger;
import org.slf4j.LoggerFactory;*/

import java.util.Scanner;

/**
 * @author zhaoqian
 * @create 2021/9/26 14:03
 */
public class TestOne {  //俄罗斯转盘源码
  //  private static Logger logger = LoggerFactory.getLogger(TestOne.class);
    private static final String success = "还活着";
    private static final String die = "死了";
    private static final String over = "游戏结束";

    public static void main(String[] args) {
        System.out.println("大转盘开始,本场使用的是沙漠之鹰(7发)");
        System.out.println("请输入子弹个数");
        Scanner scanner = new Scanner(System.in);
        Scanner scanner1 = new Scanner(System.in);
        int k = 0;
        int[] arr = {0, 0, 0, 0, 0, 0, 0};
        int i = scanner.nextInt();
        if (i== arr.length){
            System.out.println(" 死亡本体论的建构——向死而生");
        }
        if (i>arr.length){
            System.out.println("子弹数不能大于弹夹总容量，请重新输入");
            i = scanner.nextInt();
        }
        for (; i > 0; i--) {
            double random = Math.random() * 100;
            int p = (int) random % 7;
            while (arr[p] == 1) {
                random = Math.random() * 100;
                p = (int) random % 7;
            }
            arr[p] = 1;
        }
        System.out.println("请角色开枪");
        while (scanner1.hasNext()) {

            String name = scanner1.nextLine();
            String kill = kill(name, arr, k);
            System.out.println(kill);
            k++;
            if (k == arr.length) {
                System.out.println(over);
                break;
            }
        }
    }

    public static String kill(String user, int[] arr, int k) {
        String msg = user;
        if (arr[k] == 1) {
            return msg + die;
        } else if (arr[k] == 0) {
            return msg + success;
        }
        return null;

    }
}
